<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
	<title>List Complaint</title>
</head>
<body>
<a href="/spring/logout">logout</a>
	<h1>${message}</h1>
	<table style="width:500px">
				<tr>
				<td>Id</td>
			  	<td>Title</td>
			  	<td>Description</td>
			  	<td>User Id</td>
			</tr>
		<c:forEach items="${complaints}" var="c">
			<tr>
				<td><a href="/spring/complaint/${c.complaintId}"><c:out value="${c.complaintId}"></c:out></a></td>
			  	<td><c:out value="${c.title}"></c:out></td>
			  	<td><c:out value="${c.description}"></c:out></td>
			  	<td><c:out value="${c.user.userName}"></c:out></td>
			  	<td><a href="/spring/complaint/delete?id=${c.complaintId}">Delete</a></td>
			</tr>
		</c:forEach>
	</table> 
	<a href="/spring/complaint/add">Add</a>

</body>
</html>
